{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load humanize %}

{% block head %}
  <link href="{% static 'css/questions.css' %}" rel="stylesheet">
{% endblock head %}

{% block main %}
  <ol class="breadcrumb">
    <li><a href="{% url 'questions:questions_list' %}">{% trans "Questions" %}</a></li>
    <li class="active">{% trans "Question" %}</li>
  </ol>
  <div class="row question" question-id="{{ question.id }}">
    {% csrf_token %}
    <div class="col-md-11">
      <h2>{{ question.title }}</h2>
      <div class="question-user">
        <a><img src="{% static 'img/user.png' %}" class="user"></a>
        &nbsp;&nbsp;&nbsp;
        <a href="{% url 'user_profile:profile' question.user.id %}">
          {{ question.user.username }}
        </a>
        <small class="asked">{% trans 'Asked' %} {{ question.update_date|naturaltime }}</small>
      </div>
      <div class="question-description">
        {{ question.get_description_as_markdown|safe }}
      </div>
      {% if question.get_tag_list %}
        <p>
          {% for tag in question.get_tag_list %}
            <span class="label label-primary">{{ tag }}</span>
          {% endfor %}
        </p>
      {% endif %}
    </div>
  </div>
  <br><br><br>
  <h4 class="page-header">{% trans 'Answers' %}</h4>
  <div class="answers">
    {% for answer in question.get_answers %}
      {% include 'questions/answers_list.html' with answer=answer %}
    {% endfor %}
    {% if not user.is_anonymous %}
      <h4>{% trans 'Write your Answer' %}</h4>
        {% include 'questions/create_answer.html' with question=question user=user %}
    {% endif %}
  </div>
{% endblock main %}
